//package com.bestcem.xm.txtanls.grpc.handler;
//
//import com.alibaba.csp.sentinel.slots.block.BlockException;
//import com.bestcem.xm.common.core.uitls.RpcStatusResult;
//import com.bestcem.xm.txtanls.grpc.v1.services.GetAnalysisProjectRequest;
//import com.bestcem.xm.txtanls.grpc.v1.services.GetAnalysisProjectResponse;
//import io.grpc.stub.StreamObserver;
//
///**
// * @author XiaoYunSong <ys.xiao@idiaoyan.com>
// * @version v1.0
// * @date 2021/7/2 18:34
// */
//public class AnalysisGrpcServiceHandler {
//    // Block 异常处理函数，参数最后多一个 BlockException，其余与原函数一致.
//    public static void getAnalysisProjectHandler(GetAnalysisProjectRequest request,
//                                                 StreamObserver<GetAnalysisProjectResponse> responseObserver,
//                                                 BlockException ex) {
//        GetAnalysisProjectResponse.Builder builder = GetAnalysisProjectResponse.newBuilder();
//        builder.setStatus(RpcStatusResult.error("接口限流 Block"));
//        responseObserver.onNext(builder.build());
//        responseObserver.onCompleted();
//    }
//
//    // Fallback 异常处理函数，参数最后多一个 Throwable，其余与原函数一致.
//    public static void getAnalysisProjectFallback(GetAnalysisProjectRequest request,
//                                                  StreamObserver<GetAnalysisProjectResponse> responseObserver,
//                                                  Throwable throwable) {
//        GetAnalysisProjectResponse.Builder builder = GetAnalysisProjectResponse.newBuilder();
//        builder.setStatus(RpcStatusResult.error("接口限流 Fallback"));
//        responseObserver.onNext(builder.build());
//        responseObserver.onCompleted();
//    }
//}
